package com.sghd.pojo.candy.fight.vo;

import com.sghd.common.utils.codec.CryptUtils;
import com.sghd.pojo.candy.fight.enums.RoomStatus;

/**
 * @author Allen
 * @date 2019/01/08
 */
public class ServerVo {
    private Boolean isReConn;
    private Integer roomStatus;
    private String ip;
    private Integer port;
    private String token;
    private int timestamp;

    public Boolean getReConn() {
        return isReConn;
    }

    public void setReConn(Boolean reConn) {
        isReConn = reConn;
    }

    public Integer getRoomStatus() {
        return roomStatus;
    }

    public void setRoomStatus(Integer roomStatus) {
        this.roomStatus = roomStatus;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public int getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(int timestamp) {
        this.timestamp = timestamp;
    }

    public static ServerVo valueOf(String ip, int port, String token, int timestamp) {
        ServerVo serverVo = new ServerVo();
        serverVo.setIp(ip);
        serverVo.setPort(port);
        serverVo.setToken(token);
        serverVo.setRoomStatus(RoomStatus.OPEN.ordinal());
        serverVo.setTimestamp(timestamp);
        return serverVo;
    }

    /*public static ServerVo valueOf(String ip, int port, boolean isReConn) {
        ServerVo serverVo = new ServerVo();
        serverVo.setReConn(isReConn);
        serverVo.setRoomStatus(RoomStatus.OPEN.ordinal());
        serverVo.setIp(ip);
        serverVo.setPort(port);
        return serverVo;
    }*/

    public static ServerVo maintain() {
        ServerVo serverVo = new ServerVo();
        serverVo.setRoomStatus(RoomStatus.CLOSE.ordinal());
        return serverVo;
    }
}
